import WXModule from "./WXModule";
import OPPOModule from "./OPPOModule";
import VIVOModule from "./VIVOModule";
import QQModule from "./QQModule";
import HWModule from "./HWModule";
import UCModule from "./UCModule";
import TTModule from "./TTModule";
import PlatformModule from "./PlatformModule";
import ZSOPPOModule from "./ZSOPPOModule";
import BDModule from "./BDModule";
import KuaiModule from "./KuaiModule";
import { appConfig } from "../model/appConfig";
import { AppConst } from "../const/Const";
import { DEBUG } from "cc/env";
import { WebModule } from "./WebModule";
import { IPlatform } from "./IPlatform";
import { platformConf } from "./platformConf";
import { Debug } from "../utils/Debug";


export class platformUtil {


    private static mCurrentPlatform: IPlatform
    public static get currentPlatform(): IPlatform {
        if (!this.mCurrentPlatform) {
            if (platformConf.currentApp == AppConst.WX)
                this.mCurrentPlatform = new WXModule();
            else if (platformConf.currentApp == AppConst.OPPO)
                this.mCurrentPlatform = new OPPOModule();
            else if (platformConf.currentApp == AppConst.VIVO)
                this.mCurrentPlatform = new VIVOModule();
            else if (platformConf.currentApp == AppConst.OPPO_ZS) {
                this.mCurrentPlatform = new ZSOPPOModule();
            }
            else if (platformConf.currentApp == AppConst.BYTEDANCE)
                this.mCurrentPlatform = new TTModule();
            else if (platformConf.currentApp == AppConst.QQ)
                this.mCurrentPlatform = new QQModule();
            else if (platformConf.currentApp == AppConst.BAIDU)
                this.mCurrentPlatform = new BDModule();
            else if (platformConf.currentApp == AppConst.UC)
                this.mCurrentPlatform = new UCModule();
            else if (platformConf.currentApp == AppConst.HW)
                this.mCurrentPlatform = new HWModule();
            else if (platformConf.currentApp == AppConst.KUAI)
                this.mCurrentPlatform = new KuaiModule();
            else if (platformConf.currentApp == AppConst.WEB)
                this.mCurrentPlatform = new WebModule();
            else {
                this.mCurrentPlatform = new PlatformModule();
            }
            Debug.log("currentPlatform", this.mCurrentPlatform);
        }
        return this.mCurrentPlatform;
    }

    // private static currentConf: appConfig;
    // public static get config(): appConfig {
    //     return this.currentConf;
    // }
    // public static set config(value: appConfig) {
    //     this.currentConf = value
    // }

}